﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.SceneManagement;

public class GameMgr : Singleton<GameMgr>
{
    public bool Pause { get { return !_engine.enabled; } set { _engine.enabled = !value; } }

    GameEngine _engine; // 游戏引擎(驱动)

    public event Action FixedUpdateCallback
    {
        add
        {
            _engine.FixedUpdateCallback += value;
        }

        remove
        {
            _engine.FixedUpdateCallback -= value;
        }
    }

    public GameMgr()
    {
        var go = new GameObject("GameEngine");
        _engine = go.AddComponent<GameEngine>();
        GameObject.DontDestroyOnLoad(go);
    }

    internal void Init()
    {
        UIManager.Instance.Init();
        // 闪屏、更新、重启、公告
        // 用一个单独Scene，来处理进入战斗场景之前的UI
        SceneMgr.Instance.LoadScene("Scenes/Running");
        //UIManager.Instance.ReplaceUI("Prefabs/UI/Login/Login");
    }

}
